package com.yuntian.mapper;

import com.yuntian.entity.Product;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ProductMapper {

     /**
      * 获取产品信息
      */
     @Select("select * from product")
     List<Product> getProduct();

     /**
      * 新增产品信息
      */
     @Insert("insert into product (product_name, modele_no, prod_description, prod_image_url, create_time, update_time) " +
             "values (#{productName}, #{modeleNo}, #{prodDescription}, #{prodImageUrl}, #{createTime}, #{updateTime})")
     void insert(Product product);


     /**
      * 更新产品信息
      */
     @Update("update product set product_name=#{productName}, modele_no=#{modeleNo}, prod_description=#{prodDescription}, prod_image_url=#{prodImageUrl}, update_time=#{updateTime} where product_id=#{productId}")
     void update(Product product);


     /**
      * 删除产品信息
      */
     @Delete("delete from product where product_id=#{productId}")
     void delete(Integer productId);
}
